<?php
namespace app\api\controller;

class AdminRouter extends Permission
{
    public function getList()
    {
        $map['pid'] = 0;
        $list = db('AdminRouter')->where($map)->select();
        $menus = [];
        foreach ($list as $v) {
            $map['pid'] = $v['id'];
            $v['children'] = db('AdminRouter')->where($map)->select();
            if(!$v['children']) $v['children'] = [];
            $menus[] = $v;
        }

        $this->resSuc($menus);
    }

}
